<extend name="Layout/ins_page" />
<block name="content">
	{:W('PageHeader/simple',array('name'=>'编辑流程：'.$vo['name']))}
	<form method='post' id="form_data" class="well form-horizontal">
		<input type="hidden" id="id" name="id" value="{$vo.id}">
		<input type="hidden" id="opmode" name="opmode" value="edit">
		<input type="hidden" id="ajax" name="ajax" value="1">
		<input type="hidden" id="confirm" name="confirm" >
		<input type="hidden" id="confirm_name" name="confirm_name" >
		<input type="hidden" id="consult" name="consult" >
		<input type="hidden" id="consult_name" name="consult_name">
		<input type="hidden" id="refer" name="refer">
		<input type="hidden" id="refer_name" name="refer_name" >
		<div class="form-group col-sm-6">
			<label class="col-sm-4 control-label" for="name">名称*：</label>
			<div class="col-sm-8">
				<input  value="{$vo.name}" class="form-control" type="text" id="name" name="name" check="require" msg="请输入姓名">
			</div>
		</div>
		<div class="form-group col-sm-6">
			<label class="col-sm-4 control-label" for="short">简称*：</label>
			<div class="col-sm-8">
				<input  value="{$vo.short}" class="form-control" type="text" id="short" name="short" check="require" msg="请输入简称">
			</div>
		</div>

		<div class="form-group col-sm-6">
			<label class="col-sm-4 control-label" for="doc_no_format">编号规则*：</label>
			<div class="col-sm-8">
				<input value="{$vo.doc_no_format}" class="form-control" type="text" id="doc_no_format" name="doc_no_format" check="require" msg="请输入编号规则">
			</div>
		</div>

		<div class="form-group col-sm-6">
			<label class="col-sm-4 control-label" for="group">分组：</label>
			<div class="col-sm-8">
				<select class="form-control" name="tag" id="tag">
					{:fill_option($tag_list)}
				</select>
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-2 control-label" for="type">审批步骤：</label>
			<div class="col-sm-10">
				<div id="confirm_wrap" class="inputbox">
					<a class="pull-right btn btn-link text-center" onclick="popup_flow();"> <i class="fa fa-user"></i> </a>
					<div class="wrap" >
						<span class="address_list">{$vo.confirm_name}</span>
						<span class="text" >
							<input class="letter" type="text"  >
						</span>
					</div>
					<div class="search dropdown ">
						<ul class="dropdown-menu"></ul>
					</div>
				</div>
			</div>
		</div>

		<div class="form-group">
			<label class="col-sm-2 control-label" for="type">协商步骤：</label>
			<div class="col-sm-10">
				<div id="consult_wrap" class="inputbox">
					<a class="pull-right btn btn-link text-center" onclick="popup_flow();"> <i class="fa fa-user"></i> </a>
					<div class="wrap" >
						<span class="address_list">{$vo.consult_name}</span>
						<span class="text" >
							<input class="letter" type="text"  >
						</span>
					</div>
					<div class="search dropdown">
						<ul class="dropdown-menu"></ul>
					</div>
				</div>
			</div>
		</div>

		<div class="form-group hidden">
			<label class="col-sm-2 control-label" for="type">抄送：</label>
			<div class="col-sm-10">
				<div id="refer_wrap" class="inputbox">
					<a class="pull-right btn btn-link text-center" onclick="popup_flow();"> <i class="fa fa-user"></i> </a>
					<div class="wrap" >
						<span class="address_list">{$vo.refer_name}</span>
						<span class="text" >
							<input class="letter" type="text"  >
						</span>
					</div>
					<div class="search dropdown ">
						<ul class="dropdown-menu"></ul>
					</div>
				</div>
			</div>
		</div>
		<div class="form-group col-sm-6">
			<label class="col-sm-4 control-label" for="request_duty">申请权限：</label>
			<div class="col-sm-8">
				<select class="form-control" name="request_duty" id="request_duty">
					{:fill_option($duty_list)}
				</select>
			</div>
		</div>
		<div class="form-group col-sm-6">
			<label class="col-sm-4 control-label" for="report_duty">报告权限：</label>
			<div class="col-sm-8">
				<select class="form-control" name="report_duty" id="report_duty">
					{:fill_option($duty_list)}
				</select>
			</div>
		</div>
		<div class="form-group col-sm-6">
			<label class="col-sm-4 control-label" for="sort">排序：</label>
			<div class="col-sm-8">
				<input class="form-control" type="text" id="sort" name="sort" value="{$vo.sort}">
			</div>
		</div>

		<div class="form-group col-sm-6">
			<label class="col-sm-4 control-label" for="is_del">状态：</label>
			<div class="col-sm-8">
				<select class="form-control" name="is_del" id="is_del">
					<option value="0" >启用</option>
					<option value="1">禁用</option>
				</select>
			</div>
		</div>
		<div class="form-group col-sm-6">
			<label class="col-sm-4 control-label" for="is_lock">流程类型：</label>
			<div class="col-sm-8">
				<select class="form-control" name="is_lock" id="is_lock" type="select-one">
					<option value="0" >自由</option>
					<option value="1">固定</option>
				</select>
			</div>
		</div>
		<div class="form-group col-sm-6">
			<label class="col-sm-4 control-label" for="is_edit">审批人能否修改：</label>
			<div class="col-sm-8">
				<select class="form-control" name="is_edit" id="is_edit">
					<option value="0">不能修改</option>
					<option value="1">可以修改</option>
				</select>
			</div>
		</div>
		<div class="form-group col-sm-6">
			<label class="col-sm-4 control-label" for="udf_tpl">自定义模板：</label>
			<div class="col-sm-8">
				<input class="form-control" type="text" id="udf_tpl" name="udf_tpl" value="{$vo.udf_tpl}">
			</div>
		</div>
		<div class="form-group col-sm-6">
			<label class="col-sm-4 control-label" for="is_show">默认编辑器：</label>
			<div class="col-sm-8">
				<select class="form-control" name="is_show" id="is_show">
					<option value="1">显示</option>	
					<option value="0">不显示</option>					
				</select>
			</div>
		</div>
		<div class="clearfix"></div>
		<div class="form-group">
			<div class="col-xs-12">
				<textarea  class="editor" id="content" name="content" style="width:100%;height:300px;">{$vo.content}</textarea>
			</div>
		</div>
		<div class="action">
			<input class="btn btn-sm btn-primary" type="button" value="保存" onclick="save();">
			<input  class="btn btn-sm btn-default" type="button" value="取消" onclick="go_return_url();">
		</div>
	</form>
</block>
<block name="js">
	<script type="text/javascript">
		function save() {
			$("#confirm").val("");
			$("#confirm_wrap  span.address_list span").each(function() {
				$("#confirm").val($("#confirm").val() + $(this).attr("data") + '|');
			});

			$("#confirm_name").val("");
			$("#confirm_name").val($("#confirm_wrap span.address_list").html());

			$("#consult").val("");
			$("#consult_wrap span.address_list span").each(function() {
				$("#consult").val($("#consult").val() + $(this).attr("data") + '|');
			});

			$("#consult_name").val("");
			$("#consult_name").val($("#consult_wrap span.address_list").html());

			$("#refer").val("");
			$("#refer_wrap span.address_list span").each(function() {
				$("#refer").val($("#refer").val() + $(this).attr("data") + '|');
			});

			$("#refer_name").val("");
			$("#refer_name").val($("#refer_wrap span.address_list").html());

			sendForm("form_data", "{:U('save')}", "{:U('index')}");
		}

		function popup_flow() {
			winopen("{:U('popup/flow')}", 560, 470);
		}


		$(document).ready(function() {
			$(document).on("dblclick", ".inputbox .address_list b", function() {
				$(this).parent().parent().remove();
			});

			$(document).on("click", ".inputbox .address_list a.del", function() {
				$(this).parent().parent().remove();
			});

			set_val("is_del", "{$vo.is_del}");
			set_val("is_edit", "{$vo.is_edit}");
			set_val("is_show", "{$vo.is_show}");
			set_val("tag", "{$vo.tag}");
			set_val("request_duty", "{$vo.request_duty}");
			set_val("report_duty", "{$vo.report_duty}");
			set_val("is_lock", "{$vo.is_lock}");
		});
	</script>
</block>